package com.example.demo.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.validator.constraints.NotBlank;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 用户组实体类.
 * @author zmf
 */
@Entity
@Table(name = "CS_SM_GROUP_D")
@DynamicUpdate
@ApiModel("用户组信息")
public class UserGroup implements Serializable {
    private static final long serialVersionUID = 3352820763084165235L;
    @Id
    /*@SequenceGenerator(name = "GROUP_SEQ", sequenceName = "S_AAS_USERGROUP", allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "GROUP_SEQ")*/
    @Column(name = "CS_SM_GROUP_ID")
    @ApiModelProperty("用户组ID")
    private Long groupId;

    @Column(name = "GROUP_NAME",nullable = false)
    @ApiModelProperty("用户组名")
    @NotBlank
    private String groupName;

    @Column(name = "PARENT_ID")
    @ApiModelProperty("父级ID")
    private Long parentId;

    @ApiModelProperty("用户组类别")
    @Column(name = "GROUP_TYPE")
    private Integer groupType;

    @ApiModelProperty("用户组状态: 1、启用 0、注销")
    @Column(name = "STATUS",nullable = false)
    private Integer status = 1;

    /*@ApiModelProperty("创建人ID")
    @Column(name = "CREATE_USER_ID", nullable = false,updatable = false)
    private Long createUserId;

    @ApiModelProperty("更新人ID")
    @Column(name = "UPDATE_USER_ID")
    private Long updateUserId;*/

    @ApiModelProperty("创建人")
    @Column(name = "CREATE_USER_NAME")
    private String createUserName;

    @ApiModelProperty("修改人")
    @Column(name = "UPDATE_USER_NAME")
    private String updateUserName;

    @ApiModelProperty("创建时间")
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "CREATE_TIME", nullable = false,updatable = false)
    private Date insertTime;

    @ApiModelProperty("更新时间")
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "UPDATE_TIME", nullable = false)
    private Date updateTime;

    @ApiModelProperty("用户组描述信息")
    @Column(name = "DESCRIPTION")
    private String description;

    @ApiModelProperty("用户组全称")
    @Column(name = "GROUP_FULL_NAME")
    private String groupFullName;

    @ApiModelProperty("排序号")
    @Column(name = "ORDER_INDEX")
    private Long orderIndex = 0L;

    @ApiModelProperty("区域ID")
    @Column(name = "REGION_ID")
    private Long regionId;

    @ApiModelProperty("全量用户组ID")
    @Column(name = "FULL_GROUP_ID")
    private String fullGroupId;

    @ApiModelProperty("用户组标识")
    @Column(name = "GROUP_FLAG")
    private String groupFlag = "1";

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((groupId == null) ? 0 : groupId.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;
        if (getClass() != obj.getClass()) return false;
        UserGroup other = (UserGroup) obj;
        if (groupId == null) {
            if (other.groupId != null) return false;
        } else if (!groupId.equals(other.groupId)) return false;
        return true;
    }

    public Long getGroupId() {
        return groupId;
    }

    public void setGroupId(Long groupId) {
        this.groupId = groupId;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public Integer getGroupType() {
        return groupType;
    }

    public void setGroupType(Integer groupType) {
        this.groupType = groupType;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getCreateUserName() {
        return createUserName;
    }

    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }

    public String getUpdateUserName() {
        return updateUserName;
    }

    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
/*public Long getCreateUserId() {
        return createUserId;
    }

    public void setCreateUserId(Long createUserId) {
        this.createUserId = createUserId;
    }

    public Long getUpdateUserId() {
        return updateUserId;
    }

    public void setUpdateUserId(Long updateUserId) {
        this.updateUserId = updateUserId;
    }*/

    public Date getInsertTime() {
        return insertTime;
    }

    public void setInsertTime(Date insertTime) {
        this.insertTime = insertTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getGroupFullName() {
        return groupFullName;
    }

    public void setGroupFullName(String groupFullName) {
        this.groupFullName = groupFullName;
    }

    public Long getOrderIndex() {
        return orderIndex;
    }

    public void setOrderIndex(Long orderIndex) {
        this.orderIndex = orderIndex;
    }

    public Long getRegionId() {
        return regionId;
    }

    public void setRegionId(Long regionId) {
        this.regionId = regionId;
    }

    public String getFullGroupId() {
        return fullGroupId;
    }

    public void setFullGroupId(String fullGroupId) {
        this.fullGroupId = fullGroupId;
    }

    public String getGroupFlag() {
        return groupFlag;
    }

    public void setGroupFlag(String groupFlag) {
        this.groupFlag = groupFlag;
    }

    @Override
    public String toString() {
        return "UserGroup{" +
                "groupId=" + groupId +
                ", groupName='" + groupName + '\'' +
                ", parentId=" + parentId +
                ", groupType=" + groupType +
                ", status=" + status +
                ", createUserName='" + createUserName + '\'' +
                ", updateUserName='" + updateUserName + '\'' +
                ", insertTime=" + insertTime +
                ", updateTime=" + updateTime +
                ", description='" + description + '\'' +
                ", groupFullName='" + groupFullName + '\'' +
                ", orderIndex=" + orderIndex +
                ", regionId=" + regionId +
                ", fullGroupId='" + fullGroupId + '\'' +
                ", groupFlag='" + groupFlag + '\'' +
                '}';
    }
}
